###

The text widget is used for multiline text input.
events: ['changed'],
###

class tree.ui.TextView extends tree.ui.Widget
    constructor: () ->
        super
        @htmlelem = document.createElement 'textarea'
        @htmlelem.className = 'tree-textarea'
        @htmlelem.addEventListener 'keyup', @button_release
        @rows = @htmlelem.rows
        @cols = @htmlelem.cols
        
    button_release: (widget, event) =>
        @emit 'changed', {value: @htmlelem.value}
    
    get_text: () ->
        @htmlelem.value
    
    set_text: (text) ->
        @htmlelem.value = text
    
    set_row: (rows) ->
        @rows = rows
        @htmlelem.rows = rows
    
    get_rows: () ->
        @rows
    
    set_cols: (cols) ->
        @cols = cols
        @htmlelem.cols = cols
    
    get_cols: () ->
        @cols
